#!/usr/bin/env python
# coding=utf-8

import sys,os,vavava
from vavava.pyinstaller_helper import query_package,copyPyFiles
from os.path import join

def test():
    hiddenimports  = ['vavava','spiders']
    spiders = query_package("spiders")
    libs = query_package("vavava")
    for spider in spiders:
        hiddenimports.append(spider)
    for v in libs:
        hiddenimports.append(v)

    import_base = "./spiders"
    name        = "TaskServer"
    out_path    = '../../pyinstaller_output/task_server'

    vavava.pyinstaller_helper.pack (
        scripts        = ['task_server.py'],
        import_base    = import_base,
        hiddenimports  = hiddenimports,
        hookspath      = ["./hooks"],
        name           = name,
        out_path       = out_path,
        force          = True,
        datas          = [
            './task_server.conf',
            './logger.conf'
        ]
    )

    outPathBase = join(join(out_path,"dist"),name)

    copyPyFiles(
        import_base,
        join(outPathBase,"spiders")
    )


test()

